package co.edu.udem.service.subject.detail;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import co.edu.udem.dao.SubjectDetailDao;
import co.edu.udem.domain.SubjectDetail;
import co.edu.udem.service.GenericDTO;
import co.edu.udem.service.GenericService;

/**
 * @since 25/07/2012
 */
@Service("subjectDetailService")
public class SubjectDetailService implements GenericService {

	@Autowired
	private SubjectDetailDao subjectDetailDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @see co.edu.udem.service.GenericService#getObjectList(java.util.Date,
	 * java.lang.String[][], java.lang.Object[])
	 */
	public List<GenericDTO> getObjectList(Date serviceDate, String[][] orderBy,
			Object... params) {
		return SubjectDetailDTO.populateDTOList(subjectDetailDao
				.getSubjectDetailListByUserSubject((String) params[0],
						Integer.valueOf((String) params[1])));
	}

	public void addSubjectDetail(SubjectDetail subjectDetail) {
		subjectDetailDao.addSubjectDetail(subjectDetail);
	}

	public List<SubjectDetail> getSubjectDetailListBySubject(String subjectCode) {
		return subjectDetailDao.getSubjectDetailListBySubject(subjectCode);
	}
	
	public SubjectDetail getSubjectDetailById(String subjectDetailCode) {
		return subjectDetailDao.getSubjectDetailById(subjectDetailCode);
	}
	
	public void delete(String subjectDetailCode) {
		subjectDetailDao.delete(subjectDetailCode);
	}

}
